///////////////////////////////////////////////////////////////////////////////
//
// lighthouse3D - 3D Software Library
//
// File: CMeshStorage.h
//
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2013 Marcus Reinhardt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
///////////////////////////////////////////////////////////////////////////////
//
// You can find a copy of the GNU General Public License (gpl.txt) in the
// directory of the library.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _CMeshStorage_H_
#define _CMeshStorage_H_

#include <stdio.h>
#include <vector>

#include "CBasicClasses.h"

///////////////////////////////////////////////////////////////////////////////
// class CMeshData : Storage for a mesh
///////////////////////////////////////////////////////////////////////////////

//! Storage for a mesh

class CMeshData
{
public:

    CMeshData();
   ~CMeshData();

    void clear();

	int  getVertCount();
	int  getFaceCount();

	void addVert(const TMeshVertex&);
	void addFace(const TMeshTriangle&);

	TMeshVertex   *getVert(int);
	TMeshTriangle *getFace(int);

	T3DPosition   *get3DPosition();

	char          m_name[512];

private:

	std::vector<TMeshVertex>   m_verts;
	std::vector<TMeshTriangle> m_faces;
	T3DPosition           m_position;
};

///////////////////////////////////////////////////////////////////////////////
// class CMeshStorage : Stores a collection of meshes
///////////////////////////////////////////////////////////////////////////////

//! Stores a collection of meshes

class CMeshStorage
{
public:

    CMeshStorage();
    ~CMeshStorage();

    void release();

    bool addNewMesh();
    void addTex(const TMeshTexture&);
	int  getMeshCount();
	int  getTexCount();
	bool removeMesh(int mesh);

    CMeshData*   getMeshRear();
    CMeshData*   getMesh(int);
    TMeshTexture *getTex(int);

private:

	std::vector<CMeshData*> m_meshes;

	std::vector<TMeshTexture> m_texture;
};

#endif
